

import { createWebHashHistory, createRouter } from 'vue-router'

// 路由就是一种映射，一个路径一个页面
const routes = [
    {
        path: '/', 
        name: 'home',
        redirect:'/articles',
        component: () => import('@/layout/index.vue'),
        children: [
          {
            path:'/articles',
            name:'文章管理',
            redirect:'/articles/all_article',
            children:[
              {
                path: '/articles/all_article',
                name:'全部文章',
                component:()=>import('@/views/articles/AllArticles.vue')
              },
              {
                path: '/articles/my_article',
                name:'我的文章',
                component:()=>import('@/views/articles/MyArticles.vue')
              }
            ]
          },  
          {
            path:'/pingjia',
            name:'评价管理',
            redirect:'/pingjia/pp',
            children:[
              {
                path: '/pingjia/pp',
                name:'文章评价',
                component:()=>import('@/views/pingjia/command.vue')
              }
            ]
          },
          {
            path:'/personal',
            name:'个人设置',
            redirect:'/personal/myinfo',
            children:[
              {
                path: '/personal/myinfo',
                name:'个人信息',
                component:()=>import('@/views/personal/index.vue')
              }
            ]
          }
          
          // {
          //   path:'/goods',
          //   name:'商品管理',
          //   redirect:'/goods/all_goods',
          //   children:[
          //     {
          //       path: '/goods/all_goods',
          //       name:'全部商品',
          //       component:()=>import('@/views/goods/AllGoods.vue')
          //     },
          //     {
          //       path: '/goods/my_goods',
          //       name:'我的商品',
          //       component:()=>import('@/views/goods/MyGoods.vue')
          //     }
          //   ]
          // },
          // {
          //   path:'/purchase_order',
          //   name:'订单管理',
          //   redirect:'/purchase_order/finished_order',
          //   children:[
          //     {
          //       path: '/purchase_order/finished_order',
          //       name:'已完成订单',
          //       component:()=>import('@/views/purchase_order/Finished.vue')
          //     },
          //     {
          //       path: '/purchase_order/account_order',
          //       name:'待支付',
          //       component:()=>import('@/views/purchase_order/Account.vue')
          //     },
          //     {
          //       path: '/purchase_order/send_order',
          //       name:'待未发货',
          //       component:()=>import('@/views/purchase_order/Send.vue')
          //     },
          //   ]
          // }
        ]
      },
    {
        path: '/register', 
        name: 'register',
        component: () => import ('@/views/register/index.vue')
    },
    {
      path: '/login', 
      name: 'login',
      component: () => import ('@/views/login/index.vue')
  }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes,
})

export default router